-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[Clang] Attribute NoFPClass should not prevent tail call optimization. #116741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@llvm/pr-subscribers-backend-x86 @llvm/pr-subscribers-llvm-selectiondag Author: Félix-Antoine Constantin (felix642) ChangesFixes #111950 Full diff: https://github.com/llvm/llvm-project/pull/116741.diff 3 Files Affected:
diff --git a/llvm/lib/CodeGen/Analysis.cpp b/llvm/lib/CodeGen/Analysis.cpp
index f77b733c6c8f69..f492bd088bf17b 100644
--- a/llvm/lib/CodeGen/Analysis.cpp
+++ b/llvm/lib/CodeGen/Analysis.cpp
@@ -599,7 +599,7 @@ bool llvm::attributesPermitTailCall(const Function *F, const Instruction *I,
for (const auto &Attr :
{Attribute::Alignment, Attribute::Dereferenceable,
Attribute::DereferenceableOrNull, Attribute::NoAlias,
- Attribute::NonNull, Attribute::NoUndef, Attribute::Range}) {
+ Attribute::NonNull, Attribute::NoUndef, Attribute::Range, Attribute::NoFPClass}) {
CallerAttrs.removeAttribute(Attr);
CalleeAttrs.removeAttribute(Attr);
}
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 8fbab337cab6f0..8b94f31106294e 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -64,7 +64,7 @@ bool TargetLowering::isInTailCallPosition(SelectionDAG &DAG, SDNode *Node,
for (const auto &Attr :
{Attribute::Alignment, Attribute::Dereferenceable,
Attribute::DereferenceableOrNull, Attribute::NoAlias,
- Attribute::NonNull, Attribute::NoUndef, Attribute::Range})
+ Attribute::NonNull, Attribute::NoUndef, Attribute::Range, Attribute::NoFPClass})
CallerAttrs.removeAttribute(Attr);
if (CallerAttrs.hasAttributes())
diff --git a/llvm/test/CodeGen/X86/tailcall-nofpclass.ll b/llvm/test/CodeGen/X86/tailcall-nofpclass.ll
new file mode 100644
index 00000000000000..f469fbbb366228
--- /dev/null
+++ b/llvm/test/CodeGen/X86/tailcall-nofpclass.ll
@@ -0,0 +1,10 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
+; RUN: llc -mtriple=x86_64-linux < %s | FileCheck %s
+
+define dso_local noundef nofpclass(nan inf) float @_Z3foof(float noundef nofpclass(nan inf) %0) {
+; CHECK-LABEL: _Z3foof:
+; CHECK: # %bb.0:
+; CHECK-NEXT: jmp expf@PLT # TAILCALL
+ %2 = tail call fast float @llvm.exp.f32(float %0)
+ ret float %2
+}
|
c31462f to
1599ddd
Compare
…ization. Improved test
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/123/builds/9959 Here is the relevant piece of the build log for the reference |
Fixes #111950